$(function() {

	//提交建议
	$("#sub_btn").click(function() {

		var title = $("#title").val();
		var category = $('input[name="category"]:checked').val() || '建议';
		var content = $("#content").val();

		//alert(title + category +  content)

		if (title == "" || category == "" || content == "") {
			$("#errmsg").text('信息不能为空!');
			$('#my-alert').modal({
				relatedTarget: this,
			});
			return false;
		}

		var data = 'title=' + title;
		data += "&category=" + category;
		data += "&content=" + content;

		$("#sub_btn").button("loading");
		$.post('/wx/property/advise/add', data, function(result) {

			$("#sub_btn").button("reset");
			if (result.resultCode == "0") {
				$("#errmsg").text("提交成功!");
				$('#my-alert').modal({
					relatedTarget: this,
				});

				setTimeout('location.href="javascript:history.back();"', 2000);


			} else {
				$("#errmsg").text(result.datas);
				$('#my-alert').modal({
					relatedTarget: this,
				});
				return;
			}


		});



	});


});